import datetime
import time
# 获取当前时间
now_time = datetime.datetime.now()
print(now_time)

# 时间的加减
# days = 天、seconds = 秒、minutes = 分钟、hours = 小时、weeks = 周
res = now_time + datetime.timedelta(weeks=3)
print(res)

# 时间替换
# year、month、day、hour、minute、second
res2 = res.replace(year=1999)  # 将年份修改为1999
print(res2)
# 将时间戳修改为日期格式
res3 = datetime.date.fromtimestamp(time.time())
print(res3)
